package control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import gui.config.ConfigPanel;
import gui.config.EventTable;
import gui.config.SecurityRequest;

import xml.XMLWorker;

public class RemoveEvent implements ActionListener {
	
	private XMLWorker worker = null;
	private EventTable eventTable = null;

	public RemoveEvent() {
		super();
		this.worker = Values.getWorker();
		eventTable = Values.getEventTable();
		eventTable.setFilter(XMLWorker.ALLE, 0);
		eventTable.setFilter(XMLWorker.ALLE, 1);
		eventTable.setFilter(XMLWorker.ALLE, 2);
		eventTable.setFilter(XMLWorker.ALLE, 3);
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		if(eventTable.getSelectedColumn()!=-1) {
			int row = eventTable.getSelectedRow();
			int column = 0;
//			eventTable.getJTable().getSelectionModel().clearSelection();
//			eventTable.getJTable().putClientProperty("termintateEditOnFocusLost", Boolean.TRUE);
//			eventTable.getJTable().clearSelection();
			worker.remove(Integer.valueOf(eventTable.getValueAt(row, column).toString()));
			eventTable.setFilter(XMLWorker.ALLE, 0);
		}
	}

}
